# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from urllib import parse


def url_encrypt(tin, rsa_text):
    tail = '01'
    message = '!'.join([tin, rsa_text, tail])
    res2 = message.encode('utf-8')
    res3 = parse.quote(res2)
    # print('url_encrypt 1', message)
    # print('url_encrypt 2', res2)
    # print('url_encrypt 3', res3)
    return res3


if __name__ == '__main__':

    tin = '91370700165446588H'
    message = 'BVyVHB/8Z87X9SPGvVs3nrt0OpxadAs1hTKksSk3QNyL2t6kSu93HvYeiFbkRsDPForSNRGfq5HFgf+FR77TcAnipE4ZQL4pMPTQ4/oaBXsITKIrKTYVpbOmO8yLZJiVh42Hx2XkiwsS7psB5fM1L9eX5f2ZyH3yEmF6V6VsEJg='
    print('message', message)
    res = url_encrypt(tin, message)

    print('res', res)
